<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/pintuer.css">
<link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/admin.css">
<script src="${pageContext.request.contextPath}/static/js/jquery.js"></script>
<script src="${pageContext.request.contextPath}/static/js/pintuer.js"></script>
</head>
<body>
<form method="post" action="" id="listform">
  <div class="panel admin-panel" id="menu">
    <div class="panel-head"><strong class="icon-reorder"> 内容列表</strong> <a href="" style="float:right; display:none;">添加字段</a></div>
    <div class="padding border-bottom">
      <ul class="search" style="padding-left:10px;">
      <template v-for="(item, index) in menus">
      <template v-if="add == item.menuName" >
        <li> <a :href="baseUrl + item.menuUrl + '&pageNum=1 &tgId=' + item.menuPid" class="button border-main icon-plus-square-o">{{item.menuName}}</a> </li>
       </template>
       </template>
        <li>
          <input type="text" placeholder="请输入搜索关键字" name="keywords" class="input" style="width:250px; line-height:17px;display:inline-block" />
          <a href="javascript:void(0)" class="button border-main icon-search" onclick="changesearch()" > 搜索</a></li>
      </ul>
    </div>
    <table class="table table-hover text-center">
      <tr>
       <th width="100" style="text-align:left; padding-left:20px;">家庭编号</th>
        <th width="10%">农合证号</th>
        <th>医疗证号</th>
        <th>户内编码</th>
        <th>姓名</th>
        <th>与户主关系</th>
        <th>身份证号</th>
        <th>性别</th>
        <th>健康状况</th>
        <th>民族</th>
        <th>文化程度</th>
        
        
   
        <th width="310">操作</th>
      </tr>
      <volist name="list" id="vo">
      	<c:forEach items="${requestScope.areaPage.list }" var="area">
        <tr>
          <td style="text-align:left; padding-left:20px;">
           ${area.familyCode}
          </td>
          <td>
          ${area.farmingcardCode}
          </td>
          <td width="10%">
          ${area.medicalcardCode}
          </td>
          <td>
          ${ area.familyInCode} 
          </td>
          <td><font color="#00CC99">${area.name}</font></td>
          <td>
          ${ area.holderRelation} 
          </td>
          <td>
          ${ area.idcardNumber} 
          </td>
          <td>
          ${ area.sex} 
          </td>
          <td>
          ${ area.health} 
          </td>
          <td>
           ${area.nation} 
          </td>
           <td>
           ${area.cultrueDegree} 
          <td width="100">
          <template v-for="(item, index) in menus">
          
          <div class="button-group">
          <template v-if="edit == item.menuName" >
          <a :href="baseUrl + item.menuUrl + '&id=${area.idcardNumber}&tgId=' + item.menuPid" class="button border-main"><span class="icon-edit"></span>{{item.menuName}}</a>
          <!-- <a class="button border-main" href="add.html"><span class="icon-edit"></span> 修改</a> --> 
          </template>
          
          <template v-if="del == item.menuName" >
          <a class="button border-red" href="javascript:;" onclick="return del('${pageContext.request.contextPath}/sys/person.do?method=deletePersonInfo','${area.idcardNumber}','${area.familyCode}')"><span class="icon-trash-o"></span> {{item.menuName}}</a>
          <%-- <a :href="baseUrl + item.menuUrl + '&id=${area.idcardNumber}&tgId=' + item.menuPid" class="button border-red" onclick="return del(1,1,1)"><span class="icon-trash-o"></span>{{item.menuName}}</a> --%>
          <!-- <a class="button border-red" href="javascript:void(0)" onclick="return del(1,1,1)"><span class="icon-trash-o"></span> 删除</a>  -->
          </template>
         
          </div>
          
          </template>
          </td>
        </tr>
   		</c:forEach>
     
      <tr>
        <td colspan="13">
       
         <div class="pagelist">
       
			 当前 ${requestScope.areaPage.pageNum} / 
					${requestScope.areaPage.totalPage }页，共 ${requestScope.areaPage.totalRecord} 条
			
         <a href="${pageContext.request.contextPath}/sys/person.do?method=findPersonByPage&pageNum=1&tgId=${tgId}">首页</a> 
         <!-- <a href="">上一页</a> -->
         <c:if test="${requestScope.areaPage.pageNum ==1}">
					<c:forEach begin="${requestScope.areaPage.start}"
						end="${requestScope.areaPage.end}" step="1" var="i">
						<c:if test="${requestScope.areaPage.pageNum == i}">
								 <span class="current">${i}</span>
						</c:if>
						<c:if test="${requestScope.areaPage.pageNum != i}">
							<a href="${pageContext.request.contextPath}/sys/person.do?method=findPersonByPage&pageNum=${i}&tgId=${tgId}">${i}</a>
						</c:if>
					</c:forEach>
					<a href="${pageContext.request.contextPath}/sys/person.do?method=findPersonByPage&pageNum=${requestScope.areaPage.pageNum+1}&tgId=${tgId}">下一页</a>
				</c:if>
		<%--如果当前页不是第一页也不是最后一页，则有上一页和下一页这个超链接显示 --%>
					<c:if
						test="${requestScope.areaPage.pageNum > 1 && requestScope.areaPage.pageNum < requestScope.areaPage.totalPage}">
						<a href="${pageContext.request.contextPath}/sys/person.do?method=findPersonByPage&pageNum=${requestScope.areaPage.pageNum-1}&tgId=${tgId}">上一页</a>
						<c:forEach begin="${requestScope.areaPage.start}"
							end="${requestScope.areaPage.end}" step="1" var="i">
							<c:if test="${requestScope.areaPage.pageNum == i}"><span class="current">${i}</span></c:if>
							<c:if test="${requestScope.areaPage.pageNum != i}">
								<a href="${pageContext.request.contextPath}/sys/person.do?method=findPersonByPage&pageNum=${i}&tgId=${tgId}">${i}</a>
							</c:if>
						</c:forEach>
						<a href="${pageContext.request.contextPath}/sys/person.do?method=findPersonByPage&pageNum=${requestScope.areaPage.pageNum+1}&tgId=${tgId}">下一页</a>
					</c:if>
					<%-- 如果当前页是最后一页，则只有上一页这个超链接显示，下一页没有 --%>
					<c:if
						test="${requestScope.areaPage.pageNum == requestScope.areaPage.totalPage}">
						<a href="${pageContext.request.contextPath}/sys/person.do?method=findPersonByPage&pageNum=${requestScope.areaPage.pageNum-1}&tgId=${tgId}">上一页</a>
						<c:forEach begin="${requestScope.areaPage.start}"
							end="${requestScope.areaPage.end}" step="1" var="i">
							<c:if test="${requestScope.areaPage.pageNum == i}"><span class="current">${i}</span></c:if>
							<c:if test="${requestScope.areaPage.pageNum != i}">
								<a href="${pageContext.request.contextPath}/sys/person.do?method=findPersonByPage&pageNum=${i}&tgId=${tgId}">${i}</a>
							</c:if>
						</c:forEach>
					</c:if>
         <!-- <span class="current">1</span>
         <a href="">2</a>
         <a href="">3</a>
         <a href="">下一页</a> -->
         <a href="${pageContext.request.contextPath}/sys/person.do?method=findPersonByPage&pageNum=${requestScope.areaPage.totalPage}&tgId=${tgId}">尾页</a>
         <!-- <a href="">尾页</a>  -->
         </div>
        </td>
      </tr>
    </table>
  </div>
</form>
<script src="${pageContext.request.contextPath}/static/js/vue.min.js"></script>

	<!-- vue 遍历菜单 -->
	<script type="text/javascript">
   
   
    	var _vm = new Vue({
    		el : "#menu",
    		data : {
    			baseUrl : '${pageContext.request.contextPath}',
    			menus : ${resultMenus},
    			add:"添加",
    			del:"删除",
    			edit:"修改"
    			
    			
    		}
    	});
        
    </script>
<script type="text/javascript">

//搜索
function changesearch(){	
		
}

//单个删除
function del(uri,idCardNum,iscid){
	if(confirm("您确定要删除吗?")){
		$.ajax({
			type:'POST',
			url: uri, 
			dataType:'json',
			data:{
				idCardNum : idCardNum,
				familyCode:iscid
			},
			async: false,
			success:function(msg){
				var flg=true
                //根据后台返回前台的msg给提示信息加HTML
                if(true ==msg){
                	window.location.reload();
                	alert("删除成功");
                	
                	}
                else{
                	window.location.reload();
                	alert("删除失败，已经存在缴费记录");
                }
			},
			error:function(data , c){
				alert("服务器异常");
			}
		});	
	}
}

//全选
$("#checkall").click(function(){ 
  $("input[name='id[]']").each(function(){
	  if (this.checked) {
		  this.checked = false;
	  }
	  else {
		  this.checked = true;
	  }
  });
})

//批量删除
function DelSelect(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		var t=confirm("您确认要删除选中的内容吗？");
		if (t==false) return false;		
		$("#listform").submit();		
	}
	else{
		alert("请选择您要删除的内容!");
		return false;
	}
}

//批量排序
function sorts(){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){	
		
		$("#listform").submit();		
	}
	else{
		alert("请选择要操作的内容!");
		return false;
	}
}


//批量首页显示
function changeishome(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		
		$("#listform").submit();	
	}
	else{
		alert("请选择要操作的内容!");		
	
		return false;
	}
}

//批量推荐
function changeisvouch(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){
		
		
		$("#listform").submit();	
	}
	else{
		alert("请选择要操作的内容!");	
		
		return false;
	}
}

//批量置顶
function changeistop(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){		
		
		$("#listform").submit();	
	}
	else{
		alert("请选择要操作的内容!");		
	
		return false;
	}
}


//批量移动
function changecate(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){		
		
		$("#listform").submit();		
	}
	else{
		alert("请选择要操作的内容!");
		
		return false;
	}
}

//批量复制
function changecopy(o){
	var Checkbox=false;
	 $("input[name='id[]']").each(function(){
	  if (this.checked==true) {		
		Checkbox=true;	
	  }
	});
	if (Checkbox){	
		var i = 0;
	    $("input[name='id[]']").each(function(){
	  		if (this.checked==true) {
				i++;
			}		
	    });
		if(i>1){ 
	    	alert("只能选择一条信息!");
			$(o).find("option:first").prop("selected","selected");
		}else{
		
			$("#listform").submit();		
		}	
	}
	else{
		alert("请选择要复制的内容!");
		$(o).find("option:first").prop("selected","selected");
		return false;
	}
}

</script>
</body>
</html>



















